home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-11-23 | 629 b | 33 lines | [TEXT/KEEN] |
- #$YoungMath
-
- BEGIN { basicPrompt = "What is the sum of "
- do
- {
- oldX = x
- oldY = y
- x = int(1000*rand()) + 1
- y = int(1000*rand()) + 1
- if (numAsked)
- {
- sum = oldX + oldY
- if (answer+0 != sum)
- {
- response = "Sorry, the real sum is " sum "\n"
- }
- else
- {
- ++numRight
- response = "Right!\n"
- }
- }
- answer = prompt(response basicPrompt x " and " y "?")
- ++numAsked;
- } while (answer != "");
- print "You had", numRight, "correct answers"
- print "out of", numAsked, "tries."
- if (numRight/numAsked > .6)
- print "Not bad!"
- else
- print "Can we do some more?"
- }
-